﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.IO;
using System.Web;

namespace NLBS.Web
{
    public class ViewManager
    {
        
        public static string RenderView(System.Web.UI.Control control)
        {
            StringWriter output = new StringWriter();
           
            Page m_pageHolder = new Page();

            m_pageHolder.Controls.Add(control);
            HttpContext.Current.Server.Execute(m_pageHolder, output, false);

            return output.ToString();
        }
        public static string RenderPage(string page)
        {
            StringWriter output = new StringWriter();
            HttpContext.Current.Server.Execute(page, output);

            return output.ToString();
        }
        public static System.Web.UI.Control LoadControl(string control)
        {
            Page m_pageHolder = new Page();

            return m_pageHolder.LoadControl(RequestWrapper.ApplicationPath + "\\" + control);
        } 
    }


}
